package com.cskaoyan.shopping.service.impl;

import com.cskaoyan.mall.constant.ShoppingRetCode;
import com.cskaoyan.shopping.constants.GlobalConstants;
import com.cskaoyan.shopping.converter.ContentConverter;
import com.cskaoyan.shopping.dal.entitys.PanelContent;
import com.cskaoyan.shopping.dal.entitys.PanelContentItem;
import com.cskaoyan.shopping.dal.persistence.PanelContentMapper;
import com.cskaoyan.shopping.dto.AllProductCateResponse;
import com.cskaoyan.shopping.dto.AllProductRequest;
import com.cskaoyan.shopping.dto.NavListResponse;
import com.cskaoyan.shopping.dto.PanelContentDto;
import com.cskaoyan.shopping.service.IContentService;
import org.aspectj.weaver.ast.Var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * @author: 周子伟
 * @description ${}
 * @date: 2022/7/29 21:23
 */
@Service
public class IContentServiceImpl implements IContentService {

    @Autowired
    PanelContentMapper panelContentMapper;


    @Autowired
    ContentConverter contentConverter;

    @Override
    public NavListResponse queryNavList() {

        Example example = new Example(PanelContent.class);

        List<PanelContent> panelContent = panelContentMapper.selectPanelContentByPanelId(0);
        List<PanelContentDto> panelContentDtoList = contentConverter.panelContents2Dto(panelContent);
        NavListResponse navListResponse = new NavListResponse();
        navListResponse.setPannelContentDtos(panelContentDtoList);

        navListResponse.setCode(ShoppingRetCode.SUCCESS.getCode());
        navListResponse.setMsg(ShoppingRetCode.SUCCESS.getMessage());

        return navListResponse;
    }
}
